package com.xintouyun.medicine.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xintouyun.medicine.entity.Shop;
import com.xintouyun.medicine.service.ShopService;
import com.xintouyun.medicine.service.impl.ShopServiceImpl;
@WebServlet("/QueryShopServlet")
public class QueryShopServlet extends HttpServlet{

	
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		String id = request.getParameter("sid");
		int sid = Integer.parseInt(id);
		//System.out.println("========="+sid);
		ShopService shopService = new ShopServiceImpl();
		Shop shop = shopService.query(sid);
		//System.out.println("==="+shop.getSname()+"==========="+shop.getSummary());
	
		
		request.setAttribute("shop", shop);
		
		request.getRequestDispatcher("show.jsp").forward(request, response);
		
		
		
	}
	
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}
}
